﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo8
{
	class Program
	{
		static void Main(string[] args)
		{
			int[] arr = new int[10];
			arr[0] = 90; arr[1] = 70; arr[2] = 60; arr[3] = 50; arr[4] = 30; arr[5] = 20; arr[6] = 10;
			Console.WriteLine("插入前");
			foreach (var item in arr)
			{
				Console.Write("{0} ",item);
			}
			Console.WriteLine("请输入要插入的数");
			int a = int.Parse(Console.ReadLine());
			for (int i = 0; i < arr.Length; i++)
			{
				if (arr[i]==0)
				{
					arr[i] = a;
					break;
				}
			}
			for (int i = 0; i < arr.Length; i++)
			{
				for (int j = 0; j < arr.Length - 1; j++)
				{
					if (arr[j] < arr[j + 1])
					{
						int b = arr[j];
						arr[j] = arr[j + 1];
						arr[j + 1] = b;
					}
				}
			}
			
			Console.WriteLine("插入后");
			foreach (var item in arr)
			{
				Console.Write("{0} ", item);
			}
			Console.ReadLine();
		}
	}
}
